package com.luych.toolbox.data.service.dao;

import com.luych.toolbox.common.enums.DataRecoveryHistoryStatus;
import com.luych.toolbox.data.service.entity.DataRecoveryHistory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.Date;
import java.util.List;

public interface DataRecoveryHistoryDao extends JpaRepository<DataRecoveryHistory, String>, JpaSpecificationExecutor<DataRecoveryHistory> {

    Page<DataRecoveryHistory> findByNameLike(String name, Pageable pageable);

    List<DataRecoveryHistory> findByStatusIn(List<DataRecoveryHistoryStatus> status);

    List<DataRecoveryHistory> findByDataBackupHistoryId(String dataBackupHistoryId);

    int countByDataBackupHistoryId(String dataBackupHistoryId);

    long countByStartDateBetween(Date start, Date end);

}